package StudyCode.summary.zipfile;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class WriteByteToFileUsingBufferedOutputStream {
	public static void main(String[] args) {
		String strFile = "BufferedOutputStreamDemo.txt";
		BufferedOutputStream bos = null;
		try {
			FileOutputStream fos = new FileOutputStream(strFile);
			bos = new BufferedOutputStream(fos);

			byte b = 66;

			System.out.println("BufferedOutputStream: 正在写入文件");


			bos.write(b);

			System.out.println("BufferedOutputStream : 写入文件完毕");
		} catch (FileNotFoundException fnfe) {
			fnfe.printStackTrace();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		} finally {
			try {
				if (bos != null) {
					bos.flush();
					bos.close();
				}

			} catch (Exception e) {
			}

		}

	}
}
